<?php
class CollectWwwngzbcomcn extends CollectBase
{

    public static function getPageContent($url) {   

            //$url='http://www.phplover.cn';   
            import("@.ORG.Utility");   
            $pagehtml= Utility::DoGet($url);      
       
            $pagehtml = preg_replace("/　/",'',$pagehtml);   
            $pagehtml=iconv("GB2312","UTF-8//IGNORE",$pagehtml);
            //charset   
			$pageinfo[charset] = 'gb2312';
  
            //desctiption  
            preg_match('@<meta\s+name=\"*description\"*\s+content\s*=\s*([^/>]+)/*>@i',$pagehtml,$matches);  
 
            $desc = trim($matches[1]);  
            $pageinfo[description] = str_replace("\"", '',$desc);  
              
     
            preg_match('@<meta\s+name=\"*keywords\"*\s+content\s*=\s*([^/>]+)/*>@i',$pagehtml,$matches);  

            $keywords = trim($matches[1]);  
            $pageinfo[keywords] = str_replace("\"", '',$keywords);  

              
            preg_match("/<title>(.*)<\/title>/smUi",$pagehtml, $matches);  
            $pageinfo[title] = trim($matches[1]);  
            preg_match("/<body.*>(.*)<\/body>/smUi",$pagehtml, $matches);  


			$pagetitle = $pageinfo['title'];
			$pagetitle = explode('-', $pagetitle);
		    $pageinfo['plate'] = trim($pagetitle[1]);
			$pageinfo['title'] = $pagetitle[0];
			
			preg_match("/<div class=\"authi xg1\">(.*)<\/div>/smUi",$pagehtml, $matches); 
			$authi = $matches[1];
			preg_match("/<li><em>([0-9]+)<\/em>阅读<\/li>/Uisx",$pagehtml, $matches); 
			$pageinfo['views'] = $matches[1];
			
			preg_match("/<li><em>([0-9]+)<\/em>回复<\/li>/Uisx",$pagehtml, $matches);
			$pageinfo['replies'] = $matches[1];
			
			preg_match("/<span\s*title=\"([^<>]+)\">发表于/smUi",$pagehtml, $matches);
		    $pageinfo['dateline'] = $matches[1];
		    
			preg_match("/<link\s+rel='archives'\s+title='(.*)'/Uisx",$pagehtml, $matches);
		    $pageinfo['author'] = trim($matches[1]);
			
			preg_match("/<div\s*class=\"tpc_content\">(.*)<\!\-\-content_read\-\->/Uisx",$pagehtml, $matches2);
			$pageinfo['message'] = addslashes( self::replaceHtmlAndJs2($matches2[1])); 
            return $pageinfo;  
     
    }  

}
?>